<?php

/**
 * Created by PhpStorm.
 * User: raymon
 * Date: 17-7-18
 * Time: 下午9:19
 */
class Article_model extends MY_Model
{
    public $table = 'article';
    public $table_classify = 'article_classify';
    public function get_article($aid){
        $this->db->from($this->table);
        $this->db->where('id',$aid);
        $this->db->select('id, title, titleColor, content, classify, releaseTime');
        $query = $this->db->get();
        return $query->row_array();
    }
    public function get_articleList($cid=''){
        if($cid){
            $this->db->where('classify',$cid);
        }
        $this->db->from($this->table);
        $this->db->select('id, title, titleColor, classify, releaseTime');
        $query = $this->db->get();
        return $query->result_array();
    }
    public function get_classify()
    {
        $this->db->from($this->table_classify);
        $query = $this->db->get();
        return $query->result_array();
    }
}